package com.neusoft.neuiotms.dcom;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.core.task.TaskExecutor;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import com.neusoft.bizcore.activiti.annotation.EnableBizcoreActiviti;
import com.neusoft.bizcore.cache.annotation.EnableBizcoreCache;
import com.neusoft.bizcore.cloud.annotition.EnableBizcoreCloud;
import com.neusoft.bizcore.file.annotition.EnableBizcoreFileStorage;
import com.neusoft.bizcore.mom.annotation.EnableBizcoreMom;
import com.neusoft.bizcore.schedule.annotition.EnableBizcoreSchedule;
import com.neusoft.neuiotms.common.annotition.EnableNeuiotmsCommon;
import com.neusoft.neuiotms.micro.config.EnableNeuiotmsMicro;

import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableBizcoreCloud
@EnableFeignClients
@EnableSwagger2
@EnableBizcoreSchedule
@EnableNeuiotmsMicro
@EnableBizcoreMom
@EnableAutoConfiguration
@EnableBizcoreCache
@EnableScheduling
@EnableNeuiotmsCommon
@EnableBizcoreFileStorage
@EnableBizcoreActiviti
@EntityScan({"com.neusoft.bizcore.activiti.model", "com.neusoft.neuiotms.dcom", "com.neusoft.neuiotms.common" })
@EnableJpaRepositories(basePackages = {"com.neusoft.bizcore.activiti", "com.neusoft.neuiotms.dcom",
        "com.neusoft.neuiotms.common" })
@SpringBootApplication
public class DcomApplication {
    public static void main(final String[] args) {
        SpringApplication.run(DcomApplication.class, args);
    }

    @Primary
    @Bean
    public TaskExecutor primaryTaskExecutor() {
        final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        return executor;
    }
}
